<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <title>{{=settings.Portal.Title}}</title>
  <!--[if lt IE 9]>
  <script src="{{=url_for_static('js/html5.js')}}"></script>
  <![endif]-->
  <link rel="stylesheet" type="text/css" href="{{=url_for_static('site.css')}}" media="screen" />
  <link rel="stylesheet" type="text/css" href="{{=url_for_static('forms.css')}}" media="screen" />
<!-- toplinks -->
    {{block _css}}{{end}}
</head>
<body>
    {{include "menu.html"}}
    {{block container}}
    <div class="container">
    <div id="head_container">
      <div class="head">
        <div class="top_header">
            <table width="100%"><tr>
            <th align="left">&nbsp;&nbsp;&nbsp;&nbsp;Full Lifecycle Project Implement Management Tool</th>
            {{block userinfo}}
                <th align="right">
                    {{get_user_image = function('get_user_image')}}
                    {{if hasattr(request, 'user') and request.user:}}
                        欢迎！ {{=request.user.username}} <img src="{{=get_user_image(request.user, size=20)}}" align="top"/>| <img src="/static/message.gif" align="top"/><a href="/config/messages/list" target="_blank" id="">(<font color="red"><span id="messages_number"></span></font>)</a> | <a href="/static/help/index.html" target="_blank">帮助</a> | <a href="/logout">{{=_('Logout')}}</a> | <a href="/resign">更换用户</a>
                    {{else:}}
                        尚未登录！ <a href="/login">登录</a>
                    {{pass}}
            {{end}}
            </th>
            </tr></table>
        </div>
        {{block header}}
        <header>
        <div class="logo">{{=settings.Portal.Title}}</div>
        {{block nav}}
        <nav>
            <ul>
                {{block menu}}
                {{menu('home')}}
                {{end}}
            </ul>
        </nav>
        {{end}}
        </header>
        {{end}}
      </div>
    </div>
    {{block flash}}
        {{include "inc_show_flashes.html"}}
    {{end}}
    {{block sidebar}}
    {{end}}
    {{block content}}
    <div class="content">
        <div class="content_body">
            {{block content_container}}
                <!-- Conent of group -->
                <table border="0" cellspacing="5px" cellpadding="4px" style="width:100%">
                    <tr>
                        <td valign="top" align="left" width="200px">
                            {{block content_sidebar}}
    
                            {{end}}
                        </td>
                        <td valign="top" align="left" width="*">
                        <div class="content_tool">
                            {{block content_tool}}
                            {{end}}
                        </div>
                        <div class="clearfix">
                            {{block content_main}}
                            {{end}}
                        </div>
                        </td>
                        <td width="20px"></td>
                    </tr>
                </table>
            {{end}}
        </div>
    </div>
    {{end}}
    </div>
    {{block footer}}
    <footer>
        <div class="align_center">
        {{<<settings.Portal.info}}
        </div>
    </footer>{{end}}
    {{end}}

    <script type="text/javascript">
    var get_message_count=function(){
        $.ajax({
            type: "POST",
            url: "/config/messages/number",
            success: function(r){
                if (r.success == 'ok'){
                    $('#messages_number').html(r.data);
                    setTimeout(get_message_count,600000);
                }
            }
        });
    }
    $(get_message_count);
    
    //keep nav top
    var sheight = 100;
    var width = $('.container').width();
    $('#head_container').height($('div.head').outerHeight());
    $(window).scroll(function(){
        if( $(document.body).scrollTop>=sheight || 
            document.body.scrollTop>=sheight || 
            document.documentElement.scrollTop>=sheight ){
    
            $("div.head").css({top:0, left:0, zIndex:999, position:'fixed', width:width});
        }else{
            $("div.head").css({top:0, left:0, position:'relative', width:width}); 
        } 
    });
    </script>
    
</body>
</html>